-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement lastCompute #398
base: main
Are you sure you want to change the base?
Conversation
test/Spec/Memory/insert.spec.luau
Outdated
print("AQUI!") | ||
-- expect(#scope).to.equal(2) | ||
-- doCleanup(scope) | ||
-- expect(counter).to.equal(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this section was replaced with a print statement?
Or was it just left over from debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah that's a mistake. Good catch
an alternate way to do this without modifying a lot of the files would be to do
in evaluate.luau, and then set lastCompute in the "if needsComputation" block. |
Can you provide an example (with code) to highlight this issue happening with the current behavior? |
There is currently an issue with the evaluate function.
In evaluate.luau look at the section of the code that decides whether a recompute is needed. Assume
dependency.lastChange > target.lastChange
is true for one of the dependencies.Then when the computation is complete assume the new value is the same, so "targetMeaningfullyChanged" is false and target.lastChange does not update.
Then dependency.lastChange > target.lastChange will remain true and the target will keep updating unnecessarily when it has already been computed with the new value of the dependency.
A fix to this would be to introduce another property, lastCompute, which tracks the last time a stateobject was updated.